<div id="conversion">
    <div class="nav">
        <a href="#admin/purchase">
            <div class="nav-li">采购登记</div>
        </a>
        <a href="#admin/purchaselist">
            <div class="nav-li">采购列表</div>
        </a>
        <a href="#admin/purchasestock">
            <div class="nav-li">采购库存</div>
        </a>
        <div class="nav-li focus">转化成品</div>
        <a href="#admin/stock">
            <div class="nav-li">库存记录</div>
        </a>
    </div>
    <hr />
    <div class="conversion">
        <div class="choose">
            <div class="cgoods">
                <div class="title">选择商品</div>
                <select>
                    <option>--请选择商品--</option>
                </select>
                增加库存：
                <input type="number" placeholder="增加库存数" />
                <div class="method">
                	<button event-click="{{'$Event.conversion.open_create_new_goods'}}">{{$Cache.conversion.open_create_new_goods?'取消新建商品':'新建商品'}}</button>
                </div>
            </div>
            <div class="cpurchase">
                <div class="title">选择消耗品
                    <button>增加消耗品</button>
                </div>
                <select>
                    <option>--请选择消耗品--</option>
                </select>
                消耗数量：
                <input type="number" placeholder="消耗品数量" />
            </div>
        </div>
        <div class="new_goods {{$Cache.conversion.open_create_new_goods&&'focus'}}">
        	<div class="upload_images item">
				<h4 class="tab-title">商品图片管理</h4>
				<div class="tab-content">
					<div class="title">商品封面(建议尺寸:500*500)：</div>
					<br>
		
					<div class="image_show">
						{{#if $Cache.new_goods.preview_img_url}}
							<img bind-src="{{$Cache.new_goods.preview_img_url}}?imageView/1/w/160">
						{{/if}}
						<img-uploader
							upload-server-url="{{config.other.upload_image}}"
							text="上传封面图片"
							bind-input-key="$Cache.new_goods.preview_img_url"
							bind-status="{{'$Cache.shelves.preview_img_url_upload_status'}}"
							one-way="true"
							style="display:inline-block;"
							max-width="512"
							>
						</img-uploader>
					</div>
					<div class="title">商品详情图：
						<m-img-uploader 
							max-num="{{config.server_config.storeImagesNumber}}"
							max-width="1200"
							bind-status="{{'$Cache.shelves.preview_img_url_upload_status'}}"
							upload-callback="{{'$Event.mul_img_upload.cb'}}"
							upload-error-callback="{{'$Event.mul_img_upload.err_cb'}}"
							handle-progress-callback="{{'$Event.mul_img_upload.hp_cb'}}" 
							upload-progress-callback="{{'$Event.mul_img_upload.up_cb'}}"
							bind-input="{{'$Cache.mul_img_upload.imgs'}}">
							<button>{{$Cache.mul_img_upload.info||"点击批量上传"}}</button>
						</m-img-uploader>
					</div>
					<br>
					<br>
					<br>
					<div>
						{{#each $Cache.conversion.detail_img_urls}}
						<div class="with-inset-shadow" style="{{url&&'float: left; margin:5px 5px; box-shadow: 1px 1px 9px;'}}">
							<img-uploader
								bind-input-key="url"
								url="{{url}}"
								bind-status="{{'status'}}"
								text="上传商品详情图"
								style="float: left; "
								max-width="1200"
								>
							</img-uploader>
						</div>
						{{/each}}
					</div>
				</div>
			</div>

			<div class="base_info item">
				<h4 class="tab-title">商品基本信息管理</h4>
				<div class="tab-content">
					<div class="goods-name item">商品名称：<input type="text" name="goods-title" class="goods-title android" bind-input="{{'$Cache.new_goods.goods_name'}}" value="{{$Cache.new_goods.goods_name}}" /></div>

					<div class="kinds item {{$Cache.new_goods.card_factory_list.0&&'hidden'}}">
						选择标签：
						{{#each $Cache.shelves.bus_tags}}
							<div event-click="{{_checked?'$Top.$Event.tag.unuse_tag':'$Top.$Event.tag.use_tag'}}" class="kinds-item {{_checked&&'focus'}}" title="{{_checked?'点击移除':'点击添加'}}">{{tag_name}}</div>
						{{/each}}
						<div class="add-tag" style="display:inline-block;">
							<input type="text" class="goods-tag android" value="{{$Cache.tag.new_tag_name}}" bind-input="{{'$Cache.tag.new_tag_name'}}">
							<button event-click="{{'$Event.tag.add_new_tag'}}">添加标签</button>
						</div>
					</div>

					<div class="classify item">
					商品类目
						<android:selectSearch style="text-align: left;" use-value-as-result="true" value="{{$Cache.new_goods.classify_id}}" bind-input="{{'$Cache.new_goods.classify_id'}}">
						{{#> "goods-detail-classify-tree-item","$Cache.goods_detail.classify_tree",$Cache.goods_detail.classify_tree.childs.length}}
						</android:selectSearch>
					</div>
					<xmp type="template" name="goods-detail-classify-tree-item">
						{{#each childs}}
						<optionItem deep="{{deep}}" value="{{classify._id}}">
							{{$Caller.$Private.prefix}} 
							{{classify.classify_name}}
						</optionItem>
						{{#> "goods-detail-classify-tree-item","$This",childs.length}}
						{{/each}}
						<script type="text/vm">
						function(vm) {
							var optionItemNode = vm.getOneElementByTagName("optionItem");
							jSouper.onElementPropertyChange(optionItemNode, "deep", function(attrKey, value) {
								vm.set("$Private.prefix", Array(~~value).join("　") + "┗");
							}, true);
						}
						</script>
					</xmp>
					<div class="price item">原价（可不填，默认为现价）：￥<input type="text" name="goods-price" class="goods-price android" bind-input="{{'$Cache.new_goods.original_price'}}" value="{{$Cache.new_goods.original_price||$Cache.new_goods.price||''+'（现价）'}}" /></div>

					<!-- <div class="price item">VIP价（可不填，默认为现价）：￥<input type="text" name="goods-price" class="goods-price android" bind-input="{{'$Cache.new_goods.vip_price'}}" value="{{$Cache.new_goods.vip_price||$Cache.new_goods.price||''+'（现价）'}}" /></div> -->

					<div class="price item">现价：￥<input type="text" name="goods-price" class="goods-price android" bind-input="{{'$Cache.new_goods.price'}}" value="{{$Cache.new_goods.price}}" /></div>

					<div class="price item">返现：￥<input type="text" name="goods-price" class="goods-price android" bind-input="{{'$Cache.new_goods.back_cash'}}" value="{{$Cache.new_goods.back_cash}}" /></div>

					<!-- <div class="fare item">运费：<input type="text" name="goods-fare" class="goods-fare" bind-input="{{'$Cache.new_goods.fare'}}" value="{{$Cache.new_goods.fare}}" /></div> -->

					<div class="fare item">库存：<input type="text" name="goods-num" class="goods-num android" bind-input="{{'$Cache.new_goods.num'}}" value="{{$Cache.new_goods.num}}" /></div>

					<div class="fare item">单位：<input type="text" name="goods-unit" class="goods-unit android" bind-input="{{'$Cache.new_goods.unit'}}" value="{{$Cache.new_goods.unit||'件'}}" /></div>
				
					<div class="goods-express item">
						运费：
						<android:selectSearch datalist-key="$Cache.bus.goods_detail.express_list" use-value-as-result="true" value="{{$Cache.new_goods.express_id}}" search-placeholder="选择运费模板" bind-input="{{'$Cache.new_goods.express_id'}}">
						    {{#each $Cache.bus.goods_detail.express_list}}
						    <optionItem value="{{_id}}" search-data="{{name+express_com}}">{{name}}；{{express_com}} ￥{{#Fixed express_price}}</optionItem>
						    {{/each}}
						</android:selectSearch>
					</div>
					<!-- <div class="card-factory item">
						所属专区（和会员卡相关的商品专区）：
						{{#if $Cache.new_goods._id}}
							{{#if $Cache.bus.selected_card_factory}}
							<span title="{{$Cache.bus.selected_card_factory.info.intro}}">{{$Cache.bus.selected_card_factory.info.name}}</span>
							{{#else}}
							<i>任何人可买（无需指定会员卡）</i>
							{{/if}}（不可修改）
						{{#else}}
							（提交后不可修改）
							<android:selectSearch datalist-key="$Cache.bus.goods_detail.card_factory_list" use-value-as-result="true" value="{{$Cache.new_goods.card_factory_list.0}}" search-placeholder="选择商品所属专区" bind-input="{{'$Cache.new_goods.card_factory_list.0'}}" event-change="{{'$Event.goods_detail.on_card_factory_list_change'}}">
							    {{#each $Cache.bus.goods_detail.card_factory_list}}
							    <optionItem value="{{_id}}" title="{{info.intro}}" search-data="{{info.name+_id}}">{{info.name}}</optionItem>
							    {{/each}}
							</android:selectSearch>
						{{/if}}
					</div> -->
					<div class="amount_result item">
					</div>
					{{#if bus_loginer.permission.can_only_online_pay}}
					<div class="only_online_pay item">
						<android:switch checked="{{$Cache.new_goods.only_online_pay}}" bind-input="{{'$Cache.new_goods.only_online_pay'}}" >禁止商品货到付款</android:switch>
					</div>
					{{/if}}
					<div class="summary item">
						<div class="title">商品简述：</div>
						<br>
						<textarea name="summary" class="goods_summary android" placeholder="不超过150字" maxlength="150" bind-input="{{'$Cache.new_goods.intro'}}">{{$Cache.new_goods.intro}}</textarea>
					</div>
				</div>
			</div>
			<div class="summary item">
				<h4 class="tab-title">商品详细介绍</h4>
				<div class="tab-content">
				<ueditor 
					style="display: inline-block;"
					bind-input="{{'$Cache.new_goods.detail_content'}}" 
					bind-status="{{'$Cache.shelves.goods_detail_content_img_upload_status'}}"
					value="{{$Cache.new_goods.detail_content}}" >
					<!-- 但init-key所对应的内容开始存在时，初始化编辑区域 -->
				</ueditor>
				</div>
			</div>
		</div>
    </div>
</div>
